//
//  ResumeDetailsViewController.m
//  InviteJob
//
//  Created by chirui on 2017/10/26.
//  Copyright © 2017年 Shui. All rights reserved.
//

#import "ResumeDetailsViewController.h"
#import "WorkExperienceViewController.h" //工作经验
#import "ProjectExperienceViewController.h" //项目经验
#import "ReportNoMiddleTVC.h"


@interface ResumeDetailsViewController ()<UITableViewDelegate,UITableViewDataSource>{
    
    UITableView * _tableView;
    CGFloat footerHeight;
    NSDictionary * dataDic;
    UIView * bageView;
    ReportNoMiddleTVC * reportVc;
    NSInteger heightTabel;
}
@property (nonatomic, strong) SZTextView *contentTextView;

@end

@implementation ResumeDetailsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    TitleView(@"简历详情");
    self.view.backgroundColor =[UIColor whiteColor];
   
    if (_isLook!=YES) {
        [self creatEndView];
        heightTabel = 90;
    }else{
        heightTabel = 5;
    }
    
    [self creatTableView];
    self.navigationItem.rightBarButtonItem = [UIBarButtonItem rightItemWithTitle:@"举报" target:self action:@selector(reportBtn)];
    [self getDetailsRequest];
}

-(void)reportBtn{

    [self roomeReportView];
}

-(void)creatTableView {
    
    _tableView =[[UITableView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT-64-heightTabel) style:UITableViewStyleGrouped];
    _tableView.dataSource = self;
    _tableView.delegate = self;
    _tableView.backgroundColor =strColor(@"f6f6f6");
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    UIView * view =[[UIView alloc]init];
    _tableView.tableFooterView = view;
    [self.view addSubview:_tableView];
    
}

-(void)creatEndView{
    
    UIView * endView =[[UIView alloc]initWithFrame:CGRectMake(0,HEIGHT- 90 -64 , WIDTH, 90)];
    endView.backgroundColor =strColor(@"f6f6f6");
    UIButton * endBtn =[UIButton buttonWithType:UIButtonTypeSystem];
    endBtn.frame = CGRectMake(WIDTH/2-70, 10, 140, 35);
    endBtn.backgroundColor = NavBackColor;
    [endBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [endBtn setTitle:@"购买简历" forState:UIControlStateNormal];
    endBtn.layer.cornerRadius = 35/2.f;
    endBtn.layer.masksToBounds = YES;
    [endBtn addTarget:self action:@selector(buyResumeClick:) forControlEvents:UIControlEventTouchUpInside];
    [endView addSubview:endBtn];
    
    [self.view addSubview:endView];
    [self creatNoNameLabelFrame:CGRectMake(10, 55,WIDTH - 20, 20) andTextColor:[UIColor lightGrayColor] andFount:13 andTextStr:@"注：购买后可看到联系方式" andAlignment:NSTextAlignmentCenter onView:endView];
}

-(void)buyResumeClick:(UIButton *)btn{
    
    [SHJudgeTools showAlertCntrollerWithViewController:self alertControllerStyle:UIAlertControllerStyleAlert title:@"温馨提示" message:[NSString stringWithFormat:@"需%@点券可购买",dataDic[@"buy_resume"]] CallBackBlock:^(NSInteger btnIndex) {
        
        if (btnIndex==1) {
            
            [self buyResumeRequest];
            
        }
        
    } cancelButtonTitle:@"考虑一下" destructiveButtonTitle:@"购买" otherButtonTitles:nil];
 
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{

    return 5;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    if (section==0) {
        
        return 0;
    }else {
        
         NSArray * array;
        if (section==1) {
         array  = dataDic[@"certificate"];
        }
        if (section==2) {
            array  = dataDic[@"education_experience"];
        }
        if (section==3) {
            array  = dataDic[@"work_experience"];
        }
        if (section==4) {
            array  = dataDic[@"project_experience"];
        }
        
        return array.count;
    }
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if (indexPath.section==4) {
        
        return 50;
    }else {
    
        return 90;
    }
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    if (section==0) {
        
        return 360;
    }else {
        
        return 50;
    }
}

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    
    if (section==4) {
        
        if (dataDic) {
            NSMutableAttributedString * attributedString1 = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@",dataDic[@"resume_brief"]]];
            
            
            NSMutableParagraphStyle * paragraphStyle1 = [[NSMutableParagraphStyle alloc] init];
            [paragraphStyle1 setLineSpacing:7];
            [attributedString1 addAttribute:NSParagraphStyleAttributeName value:paragraphStyle1 range:NSMakeRange(0, [[NSString stringWithFormat:@"%@",dataDic[@"resume_brief"]] length])];
            UILabel * workDetailsLabel = [self creatLabelFrame:CGRectMake(10, 15,WIDTH -30, 20) andTextColor:RGB(0x333333) andFount:15 andTextStr:@"" andAlignment:NSTextAlignmentLeft onView:nil];
            workDetailsLabel.attributedText = attributedString1;
            workDetailsLabel.numberOfLines = 0;
            [workDetailsLabel sizeToFit];
            
            footerHeight = CGRectGetMaxY(workDetailsLabel.frame)+60;
            
             return footerHeight;
            
        }else{
       
              footerHeight = 60;
             return footerHeight;
       
        }
        
    }else {
    return 0.01;
    }
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static  NSString * str = @"cellid";
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:str];
    
    if (cell==nil) {
        
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:str];
    }else {
        while ([cell.contentView.subviews lastObject]!=nil) {
            [[cell.contentView.subviews lastObject] removeFromSuperview];
        }
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.contentView.backgroundColor =strColor(@"f6f6f6");
    if (indexPath.section==1) {
        
        NSDictionary * dic = dataDic[@"certificate"][indexPath.row];
        UIView * bgView =[[UIView alloc]initWithFrame:CGRectMake(5, 0, WIDTH-10, 80)];
        bgView.backgroundColor =[UIColor whiteColor];
        
         [self creatNoNameLabelFrame:CGRectMake(10, 15,WIDTH - 115, 20) andTextColor:[UIColor blackColor] andFount:15 andTextStr:dic[@"name"] andAlignment:NSTextAlignmentLeft onView:bgView];
        
        [self creatNoNameLabelFrame:CGRectMake(WIDTH - 115, 15,100, 20) andTextColor:[UIColor lightGrayColor] andFount:14 andTextStr:dic[@"level"] andAlignment:NSTextAlignmentRight onView:bgView];
        
         [self creatNoNameLabelFrame:CGRectMake(10, 45,WIDTH - 115, 20) andTextColor:[UIColor lightGrayColor] andFount:14 andTextStr:dic[@"major"] andAlignment:NSTextAlignmentLeft onView:bgView];
        
        [cell.contentView addSubview:bgView];
        
    }else if (indexPath.section==2){
    
         NSDictionary * dic = dataDic[@"education_experience"][indexPath.row];
        UIView * bgView =[[UIView alloc]initWithFrame:CGRectMake(5, 0, WIDTH-10, 80)];
        bgView.backgroundColor =[UIColor whiteColor];
        
        [self creatNoNameLabelFrame:CGRectMake(10, 15,WIDTH - 115, 20) andTextColor:[UIColor blackColor] andFount:15 andTextStr:dic[@"school_name"] andAlignment:NSTextAlignmentLeft onView:bgView];
        
        [self creatNoNameLabelFrame:CGRectMake(WIDTH - 115, 15,100, 20) andTextColor:[UIColor lightGrayColor] andFount:14 andTextStr:dic[@"graduate_year"] andAlignment:NSTextAlignmentRight onView:bgView];
        
        [self creatNoNameLabelFrame:CGRectMake(10, 45,WIDTH - 115, 20) andTextColor:[UIColor lightGrayColor] andFount:14 andTextStr:[NSString stringWithFormat:@"%@ %@",dic[@"profession"],dic[@"education"]] andAlignment:NSTextAlignmentLeft onView:bgView];
        
        [cell.contentView addSubview:bgView];
    
    }else if (indexPath.section==3){

         NSDictionary * dic = dataDic[@"work_experience"][indexPath.row];
        UIView * bgView =[[UIView alloc]initWithFrame:CGRectMake(5, 0, WIDTH-10, 80)];
        bgView.backgroundColor =[UIColor whiteColor];
        
        [self creatNoNameLabelFrame:CGRectMake(10, 15,150, 20) andTextColor:[UIColor blackColor] andFount:15 andTextStr:dic[@"position"] andAlignment:NSTextAlignmentLeft onView:bgView];
        
        [self creatNoNameLabelFrame:CGRectMake(WIDTH - 140, 15,120, 20) andTextColor:[UIColor lightGrayColor] andFount:14 andTextStr:[NSString stringWithFormat:@"%@-%@",dic[@"in_date"],dic[@"out_date"]]  andAlignment:NSTextAlignmentRight onView:bgView];
        
        [self creatNoNameLabelFrame:CGRectMake(10, 45,WIDTH - 115, 20) andTextColor:[UIColor lightGrayColor] andFount:14 andTextStr:dic[@"company_name"] andAlignment:NSTextAlignmentLeft onView:bgView];
        
        [cell.contentView addSubview:bgView];
    }else{
         NSDictionary * dic = dataDic[@"project_experience"][indexPath.row];
        UIView * bgView =[[UIView alloc]initWithFrame:CGRectMake(5, 0, WIDTH-10, 40)];
        bgView.backgroundColor =[UIColor whiteColor];
        
        [self creatNoNameLabelFrame:CGRectMake(10, 10,WIDTH - 155, 20) andTextColor:[UIColor blackColor] andFount:15 andTextStr:dic[@"project_name"] andAlignment:NSTextAlignmentLeft onView:bgView];
        
        [self creatNoNameLabelFrame:CGRectMake(WIDTH - 140, 10,120, 20) andTextColor:[UIColor lightGrayColor] andFount:14 andTextStr:[NSString stringWithFormat:@"%@-%@",dic[@"b_time"],dic[@"e_time"]] andAlignment:NSTextAlignmentRight onView:bgView];
        
        [cell.contentView addSubview:bgView];
    }
    
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    if (indexPath.section==3) {
        
         NSDictionary * dic = dataDic[@"work_experience"][indexPath.row];
        WorkExperienceViewController * work =[[WorkExperienceViewController alloc]init];
        work.workDic = dic;
        [self.navigationController pushViewController:work animated:YES];
    }else if (indexPath.section==4){
         NSDictionary * dic = dataDic[@"project_experience"][indexPath.row];
        ProjectExperienceViewController * project = [[ProjectExperienceViewController alloc]init];
        project.projectDic = dic;
        [self.navigationController pushViewController:project animated:YES];
    }
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    
    
    if (section==0) {

    UIView * heardView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, 360)];
    heardView.backgroundColor = strColor(@"f6f6f6");
    
    
    UIView * topView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, 90)];
    topView.backgroundColor =[UIColor whiteColor];
    [heardView addSubview:topView];

    if (dataDic) {
        
    UIImageView * companyImage =[[UIImageView alloc]initWithFrame:CGRectMake(10, 20, 50, 50)];
    [companyImage sd_setImageWithURL:dataDic[@"avatar"] placeholderImage:ImageName(@"img_default_head")];
    companyImage.layer.cornerRadius = 25.f;
    companyImage.layer.masksToBounds = YES;
    [topView addSubview:companyImage];
    
    UILabel * comLabel = [self creatLabelFrame:CGRectMake(70, 25,30, 20) andTextColor:RGB(0x333333) andFount:15 andTextStr:dataDic[@"user_name"] andAlignment:NSTextAlignmentLeft onView:topView];
    comLabel.numberOfLines = 1;
    [comLabel sizeToFit];
    
    UILabel * tagLabel = [self creatLabelFrame:CGRectMake(60, 55,30, 20) andTextColor:[UIColor lightGrayColor] andFount:14 andTextStr:[NSString stringWithFormat:@"【%@】",dataDic[@"cate_name"]]andAlignment:NSTextAlignmentLeft onView:topView];
    tagLabel.numberOfLines = 1;
    [tagLabel sizeToFit];
    
   [self creatNoNameLabelFrame:CGRectMake(WIDTH - 100, 35,90, 20) andTextColor:NavBackColor andFount:16 andTextStr:dataDic[@"salary"] andAlignment:NSTextAlignmentRight onView:topView];
    
    [self creatTitleLabelFrame:CGRectMake(10, 105, 200, 20) andText:@"基本信息" onView:heardView];
    
    UIView * basicView = [[UIView alloc]initWithFrame:CGRectMake(5, 140, WIDTH-10, 220)];
    basicView.backgroundColor =[UIColor whiteColor];
    [heardView addSubview:basicView];
    
    [self creatNoNameLabelFrame:CGRectMake(10, 15,WIDTH -30, 20) andTextColor:[UIColor lightGrayColor] andFount:15 andTextStr:[NSString stringWithFormat:@"性 别：%@",dataDic[@"sex"]] andAlignment:NSTextAlignmentLeft onView:basicView];
    [self creatNoNameLabelFrame:CGRectMake(10, 37,WIDTH -30, 20) andTextColor:[UIColor lightGrayColor] andFount:15 andTextStr:[NSString stringWithFormat:@"学 历：%@",dataDic[@"education"]] andAlignment:NSTextAlignmentLeft onView:basicView];
    [self creatNoNameLabelFrame:CGRectMake(10, 59,WIDTH -30, 20) andTextColor:[UIColor lightGrayColor] andFount:15 andTextStr:[NSString stringWithFormat:@"年 龄：%@",dataDic[@"age"]] andAlignment:NSTextAlignmentLeft onView:basicView];
    [self creatNoNameLabelFrame:CGRectMake(10, 83,WIDTH -30, 20) andTextColor:[UIColor lightGrayColor] andFount:15 andTextStr:[NSString stringWithFormat:@"工作年限：%@",dataDic[@"work_year"]] andAlignment:NSTextAlignmentLeft onView:basicView];
    [self creatNoNameLabelFrame:CGRectMake(10, 109,WIDTH -30, 20) andTextColor:[UIColor lightGrayColor] andFount:15 andTextStr:[NSString stringWithFormat:@"所在区域：%@%@",dataDic[@"city_name"],dataDic[@"county_name"]] andAlignment:NSTextAlignmentLeft onView:basicView];
    [self creatNoNameLabelFrame:CGRectMake(10, 133,WIDTH -30, 20) andTextColor:[UIColor lightGrayColor] andFount:15 andTextStr:[NSString stringWithFormat:@"联系电话：%@",dataDic[@"phone"]] andAlignment:NSTextAlignmentLeft onView:basicView];
        
    [self creatNoNameLabelFrame:CGRectMake(10, 159,WIDTH -30, 20) andTextColor:[UIColor lightGrayColor] andFount:15 andTextStr:[NSString stringWithFormat:@"联系邮箱：%@",dataDic[@"email"]] andAlignment:NSTextAlignmentLeft onView:basicView];
    [self creatNoNameLabelFrame:CGRectMake(10, 184,WIDTH -30, 20) andTextColor:[UIColor lightGrayColor] andFount:15 andTextStr:[NSString stringWithFormat:@"专业/方向：%@",dataDic[@"direction"]] andAlignment:NSTextAlignmentLeft onView:basicView];
    }
    return heardView;
    }else {
    
        UIView * heardView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, 50)];
        heardView.backgroundColor = strColor(@"f6f6f6");
        
        NSString * titleStr;
      
        switch (section) {
            case 1:
                 titleStr = @"持有证书";
                break;
            case 2:
                titleStr = @"教育经历";
                break;
            case 3:
                titleStr = @"工作经验";
                break;
            case 4:
                titleStr = @"项目经验";
                break;
            default:
                break;
        }
        [self creatTitleLabelFrame:CGRectMake(10, 15, 200, 20) andText:titleStr onView:heardView];
        
         return heardView;
    }
}

-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{

    if (section==4) {
    UIView * footerView =[[UIView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, footerHeight)];
    footerView.backgroundColor =strColor(@"f6f6f6");
    
     [self creatTitleLabelFrame:CGRectMake(10, 15, 200, 20) andText:@"自我评价" onView:footerView];
    
    UIView * bgView =[[UIView alloc]initWithFrame:CGRectMake(5, 50, WIDTH-10, 30)];
    bgView.backgroundColor =[UIColor whiteColor];
        if (dataDic) {
            NSMutableAttributedString * attributedString1 = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@",dataDic[@"resume_brief"]]];
            
            
            NSMutableParagraphStyle * paragraphStyle1 = [[NSMutableParagraphStyle alloc] init];
            [paragraphStyle1 setLineSpacing:7];
            [attributedString1 addAttribute:NSParagraphStyleAttributeName value:paragraphStyle1 range:NSMakeRange(0, [[NSString stringWithFormat:@"%@",dataDic[@"resume_brief"]] length])];
            UILabel * workDetailsLabel = [self creatLabelFrame:CGRectMake(10, 15,WIDTH -30, 20) andTextColor:RGB(0x333333) andFount:15 andTextStr:@"" andAlignment:NSTextAlignmentLeft onView:bgView];
            workDetailsLabel.attributedText = attributedString1;
            workDetailsLabel.numberOfLines = 0;
            [workDetailsLabel sizeToFit];
            
            bgView.frame = CGRectMake(5, 50, WIDTH-10, CGRectGetMaxY(workDetailsLabel.frame)+10);
        }else{
        
             bgView.frame = CGRectMake(5, 50, WIDTH-10, 50);
        }
   
    
    [footerView addSubview:bgView];
    return footerView;
    }else {
    
        return nil;
    }
}

-(void)getDetailsRequest{
    
    isUser
    NSDictionary * dic = @{@"resume_id":self.resumeIdStr,
                           @"user_id":user.user_id,
                           @"token":user.token
                          };
    
    [PostNetWorking postNetWorkingStr:RequestUrlStr(resume_details_api) andparameters:dic Success:^(id responseObject) {
        SHuiMBHidleYes;
        if (codeSucess) {

            dataDic = responseObject[@"datas"];
            
        }else {
            
            SHuiMBhudTextTimeStr(responseObject[@"mark"]);
        }
        [_tableView reloadData];
        
    } failed:^(NSError *error) {
        
        SHuiMBHidleYes;
        SHuiMBhudTextNetError;
    }];
}

//举报弹出框
-(void)roomeReportView {
    UIWindow *window = [[UIApplication sharedApplication].delegate window];
    bageView =[[UIView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
    bageView.backgroundColor =[UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.5];
    [window addSubview:bageView];
    
    reportVc  = [[[NSBundle mainBundle] loadNibNamed:@"ReportNoMiddleTVC" owner:nil options:nil] lastObject];
    
    self.contentTextView = [[SZTextView alloc]initWithFrame:CGRectMake(10, 60, 260, 95)];
    self.contentTextView.font = [UIFont systemFontOfSize:15];
    self.contentTextView.placeholder = @"请输入举报内容";
    [reportVc.bgView addSubview:self.contentTextView];
    
    reportVc.center = CGPointMake(bageView.center.x, self.view.center.y-64);
    
    [reportVc.sureBtn addTarget:self action:@selector(alertSureBtn:) forControlEvents:UIControlEventTouchUpInside];
    [reportVc.closeBtn addTarget:self action:@selector(alertCloseBtn:) forControlEvents:UIControlEventTouchUpInside];
    [bageView addSubview:reportVc];

    
}

-(void)alertSureBtn:(UIButton *)btn{
    
    [bageView removeFromSuperview];
    if(self.contentTextView.text.length==0||self.contentTextView.text==nil){
        
        SHuiMBhudTextTimeStr(@"请输入举报内容");
        return;
    }else {
        
        [self reportMessageDetailsRequest];
    }
}

-(void)alertCloseBtn:(UIButton *)btn{
    
    [bageView removeFromSuperview];
}

-(void)reportMessageDetailsRequest{
    
    isUser
    
    //    1、招聘，2、建企服务，3、简历
    NSDictionary * datadic = @{@"ser_id":self.resumeIdStr,
                               @"user_id":user.user_id,
                               @"token":user.token,
                               @"type":@"3",
                               @"content":self.contentTextView.text
                               };
    
    [PostNetWorking postNetWorkingStr:RequestUrlStr(Report_request_api) andparameters:datadic Success:^(id responseObject) {
        SHuiMBHidleYes;
        if (codeSucess) {
            
            SHuiMBhudTextTimeStr(@"举报成功");
            
        }else {
            
            SHuiMBhudTextTimeStr(responseObject[@"mark"]);
        }
        //        [_tableView reloadData];
        
    } failed:^(NSError *error) {
        
        SHuiMBHidleYes;
        SHuiMBhudTextNetError;
    }];
}

-(void)buyResumeRequest{

    isUser

    NSDictionary * datadic = @{@"resume_id":self.resumeIdStr,
                               @"user_id":user.user_id,
                               @"token":user.token};
    
    [PostNetWorking postNetWorkingStr:RequestUrlStr(buy_resume_api) andparameters:datadic Success:^(id responseObject) {
        SHuiMBHidleYes;
        if (codeSucess) {
            
            SHuiMBhudTextTimeStr(@"购买成功");
            
            [self getDetailsRequest];
            
        }else {
            
            SHuiMBhudTextTimeStr(responseObject[@"mark"]);
        }
       
        
    } failed:^(NSError *error) {
        
        SHuiMBHidleYes;
        SHuiMBhudTextNetError;
    }];


}



-(UILabel *)creatLabelFrame:(CGRect)rec andTextColor:(UIColor *)col andFount:(CGFloat)fount andTextStr:(NSString *)str andAlignment:(NSTextAlignment)alignment onView:(UIView *)view{
    
    UILabel * label =[[UILabel alloc]initWithFrame:rec];
    label.font =[UIFont systemFontOfSize:fount];
    label.textColor =col;
    label.text = str;
    label.textAlignment = alignment;
    [view addSubview:label];
    return label;
}


-(void)creatNoNameLabelFrame:(CGRect)rec andTextColor:(UIColor *)col andFount:(CGFloat)fount andTextStr:(NSString *)str andAlignment:(NSTextAlignment)alignment onView:(UIView *)view{
    
    UILabel * label =[[UILabel alloc]initWithFrame:rec];
    label.font =[UIFont systemFontOfSize:fount];
    label.textColor =col;
    label.text = str;
    label.textAlignment = alignment;
    [view addSubview:label];
}

-(void)creatTitleLabelFrame:(CGRect)rec andText:(NSString *)str onView:(UIView *)view{
    
    UILabel * tag_one =[[UILabel alloc]initWithFrame:rec];
    tag_one.font = [UIFont systemFontOfSize:16];
    tag_one.text = str;
    [view addSubview:tag_one];
}

-(void)creatLineViewFrame:(CGRect)rec onView:(UIView *)view{
    
    UIView * lineView = [[UIView alloc]initWithFrame:rec];
    lineView.backgroundColor = strColor(@"f6f6f6");
    [view addSubview:lineView];
}

@end
